﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Model;
using Dal;
using easysql;

namespace Web.service.system
{
    /// <summary>
    /// SourceService 的摘要说明
    /// </summary>
    public class SourceService : BaseService<object>
    {

        public object UploadImage(HttpContext context)
        {
            HttpFileCollection files = context.Request.Files;
            if (files.Count > 0)
            {
                string guid = System.Guid.NewGuid().ToString();
                string filePath = AppDomain.CurrentDomain.BaseDirectory + "/source/" + guid + ".png";
                files[0].SaveAs(filePath);
                return new { success = true, imgurl = "/source/" + guid + ".png" };
            }
            throw new IException("上传文件失败");
        }
    }
}